package net.telesing.tcmc.core;

import javax.servlet.ServletContext;

/**
 * Created 白义顺 on 2015/4/25.
 */
public class Utils
{
    private ServletContext sc;

    public String getPath(String path)
    {
        return cut(sc.getRealPath(path).replace("\\", "/"), 2);
    }

    public String cut(String root,long cut)
    {
        String regEx = "(/\\w*){"+(cut)+"}$";
        return root.replaceFirst(regEx,"/")+"files/temp";
    }
}
